import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import user from './module/user'
import app from './module/app'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {

    },
    mutations: {

    },
    actions: {

    },
    modules: {
        user,
        app
    },
    plugins: [createPersistedState({
        key: 'release',
        reducer(val) {
            return {
                app: val.app,
                permission: val.permission,
                user: {
                    Information: val.user.Information,
                    avatarImgPath: val.user.avatarImgPath,
                    identities: val.user.identities,
                    token: val.user.token,
                    userName: val.user.userName,
                    userId: val.user.userId,
                    userInfo: val.user.userInfo,
                }
            }
        }
    })]

})